const {log} = require("console");
const fs = require("fs");

function dg(p) {
    // fs.readdir(p, (err, data) => {
    // console.log(data);
    let data = fs.readdirSync(p);
    data.forEach((a) => {
        console.log(a);
        let path = p + "/" + a;
        let stat = fs.statSync(path)
        if (stat.isFile()) {
            fs.unlinkSync(path)
        } else {
            dg(path);
        }
    })
    fs.rmdirSync(p)
}
dg(__dirname + "/ceshi")